package com.dp.appi.service.impl;

import com.dp.appi.dao.OrgUserDao;
import com.dp.appi.service.OrgUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by bchen on 2016/5/21.
 */
@Service
@Transactional(rollbackFor=Exception.class)
public class OrgUserServiceImpl implements OrgUserService{

    @Autowired
    private OrgUserDao orgUserDao;

    /**
     * 获取单位列表
     *
     * @param orgType
     * @return
     */
    @Override
    public List<Map<String, Object>> orgList(String orgType) {
        int org_type = Integer.parseInt(orgType);
        return orgUserDao.orgList(org_type);
    }

    /**
     * 获取单位子级列表
     *
     * @param orgType
     * @return
     */
    @Override
    public List<Map<String, Object>> orgChildList(String orgID,String orgType) {
        return orgUserDao.orgChildList(orgID,orgType);
    }

    /**
     * 获取人员列表
     *
     * @param design_unit
     * @param userType
     * @return
     */
    @Override
    public  List<Map<String, Object>> userByTypeList(String design_unit, String userType,String userId) {
        return orgUserDao.userByTypeList(design_unit,userType,userId);
    }

    /**
     * 根据用户名获取组织机构
     *
     * @param username
     * @return
     */
    @Override
    public Map<String, Object> getOrgByUsername(String username) {
        return orgUserDao.getOrgByUsername(username);
    }

    /**
     * 获取当前用户信息
     *
     * @param username
     * @return
     */
    @Override
    public List<Map<String, Object>> userByUsernameList(String username,String userstageId) {
        return orgUserDao.userByUsernameList(username,userstageId);
    }
    @Override
    public    List<Map<String,Object>> userByUserPhoneList(String userPhone) {
        return orgUserDao.userByUserPhoneList(userPhone);
    }
}
